package com.hl.web.fore;

import com.hl.pojo.AnswerLeaveWord;
import com.hl.service.AnswerLeaveWordService;
import com.hl.util.ResultEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/answerLeaveWord")
public class AnswerLeaveWordController {
    @Autowired
    private AnswerLeaveWordService answerLeaveWordService;

    @PostMapping("/add")
    public ResultEntity add(@RequestBody AnswerLeaveWord answerLeaveWord) {
        return ResultEntity.ok(answerLeaveWordService.add(answerLeaveWord));
    }

    @GetMapping("/findById")
    public ResultEntity findById(String id) {
        return ResultEntity.ok(answerLeaveWordService.findById(id));
    }
    @GetMapping("/findByConsultantId")
    public ResultEntity findByConsultantId(Integer consultantId) {
        return ResultEntity.ok(answerLeaveWordService.findByConsultantId(consultantId));
    }
    @GetMapping("/findAll")
    public ResultEntity findAll() {
        return ResultEntity.ok(answerLeaveWordService.findAll());
    }
    @PostMapping("/update")
    public ResultEntity update(@RequestBody AnswerLeaveWord answerLeaveWord) {
        return ResultEntity.ok(answerLeaveWordService.update(answerLeaveWord));
    }

    @GetMapping("/delete")
    public ResultEntity delete(String id) {
        return ResultEntity.ok(answerLeaveWordService.delete(id));
    }

}
